	// A 标签
	var A=function(selector){
		this.selector=selector;
		this.element=$(selector).get(0);
	}
	A.prototype=new Control();
	A.prototype.init=function(){
		this.update();
	}
	A.prototype.update=function(){
		var self=this;
		if($(this.element).attr("href")=="" || this.element.getAttribute("href")=="" || this.element.getAttribute("href")==null){
			this.element.removeAttribute("href")
		}
		
		/*if(this.element.getAttribute("href")=="" || this.element.getAttribute("href")=="#" || "" || typeof(this.element.getAttribute("href"))=="object"){
			this.element.removeAttribute("href")
			this.element.removeAttribute("target")
		}*/
		$(this.element).bind("click",function(event){return self.clickHandle(event)})
		
		/*if(this.element.target=="autoWindowFrame"){
			var src=$(this.element).attr("href")
			var title=this.element.getAttribute("title")
			if(src!="" && typeof(src)!="undefined"){
				top.windowFrameOpen(src,title);
			}
		}*/
	}
	
	
	A.prototype.clickHandle=function(event){
		//点击完后变到已查看 viewed状态
		if(this.element.getAttribute("class")!="" && this.element.getAttribute("class")!=null){
			if(this.element.getAttribute("class").indexOf("clickToViewed")!="-1"){
				//alert("clickToViewed");
				this.element.className+=" viewed";
				if(this.element.innerHTML=="查看"){
					this.element.innerHTML="已查看"
				}
				/*try{
					var parentNode=this.element.parentNode.parentNode;
					var aElements=$("a.clickToViewed",parentNode)
					for(var i=0;i<aElements.length;i++){
						aElements.eq(i).removeClass("clickToViewed")
						aElements.eq(i).addClass("viewed")
					}
				}catch(errors){
					console.log(errors);
				}*/
			}
		}
		var href=this.element.getAttribute("href")
		var title=this.element.getAttribute("title")
		var className=this.element.getAttribute("class")
		
		//弹出匹配
		var regExp=new RegExp("ht-Popup");
		if(regExp.test(className)){
			return this.popupHandle();
		}
		//target方式弹出
		if(this.element.target=="ht-newFrameWindow"){
			if(href!="" && href!="#" && typeof(href)!="undefined" && href!=null){
				href=this.element.href
				//var frameWindow=top.htmlTurbo.openFrameWindow(href,title,"");
				//top.htmlTurbo.setFocusFrameWindow(frameWindow)
				
				var frameWindow=htmlTurbo.openFrameWindow(href,title,"");
				htmlTurbo.setFocusFrameWindow(frameWindow)
			}
			return false;
		}
		if(this.element.target=="ht-newLargeFrameWindow"){
			if(href!="" && href!="#" && typeof(href)!="undefined" && href!=null){
				href=this.element.href
				//var frameWindow=top.htmlTurbo.openFrameWindow(href,title,"large");
				//top.htmlTurbo.setFocusFrameWindow(frameWindow)
				
				var frameWindow=htmlTurbo.openFrameWindow(href,title,"large");
				htmlTurbo.setFocusFrameWindow(frameWindow)
			}
			return false;
		}
		if(this.element.target=="ht-newSmallFrameWindow"){
			if(href!="" && href!="#" && typeof(href)!="undefined" && href!=null){
				href=this.element.href
				//var frameWindow=top.htmlTurbo.openFrameWindow(href,title,"small");
				//top.htmlTurbo.setFocusFrameWindow(frameWindow)
				
				var frameWindow=htmlTurbo.openFrameWindow(href,title,"small");
				htmlTurbo.setFocusFrameWindow(frameWindow)
			}
			return false;
		}
		
		
		if(this.element.target=="ht-newFullScreenWindowFrame"){
			if(href!="" && href!="#" && typeof(href)!="undefined" && href!=null){
				href=this.element.href
				//var frameWindow=top.htmlTurbo.openFrameWindow(href,title,"fullScreen");
				//top.htmlTurbo.setFocusFrameWindow(frameWindow)
				
				var frameWindow=htmlTurbo.openFrameWindow(href,title,"fullScreen");
				htmlTurbo.setFocusFrameWindow(frameWindow)
			}
			return false;
		}
		if(this.element.target=="ht-newFreeWindowFrame"){
			if(href!="" && href!="#" && typeof(href)!="undefined" && href!=null){
				href=this.element.href
				//var frameWindow=top.htmlTurbo.openFrameWindow(href,title,"free");
				//top.htmlTurbo.setFocusFrameWindow(frameWindow)
				
				var frameWindow=htmlTurbo.openFrameWindow(href,title,"free");
				htmlTurbo.setFocusFrameWindow(frameWindow)
			}
			return false;
		}
		
		if(this.element.getAttribute("target")=="_blank"){
			if(href=="" || href=="#"){
				return false;
			}
		}
		/*
		if(this.element.target=="windowFrame"){
			var href=this.element.href
			var title=this.element.title
			//console.log(window)
			//alert(href.indexOf("##"))
			if(href.indexOf("##")==-1 || !href.indexOf("##")){
				window.openedFrameWindow=top.windowFrameOpen(title,href,window);
			}
			return false;
		}
		 */
	}
	
	
	
	
	
	
	
	
	
	
	
	A.prototype.popupHandle=function(){
		var href=this.element.getAttribute("href")
		var title=this.element.getAttribute("title")
		var className=this.element.getAttribute("class")
		if(href=="" || href=="#" || href=="##" || href=="###" || typeof(href)=="undefined" || href ==null){
			return false;
		}
		//href属性不是全地址
		href=this.element.href
		
		target=this.element.target;
		
		var context=window
		if(target == "top"){
			context=top
		}
		if(target == "parent"){
			context=parent
		}
		//top.htmlTurbo.openDialog(href);
		//return false;
		
		var regExp=null;
		var size="";
		var popupType="frame";
		
		regExp=new RegExp("frame|Frame");
		if(regExp.test(className)){
			popupType="frame";
		}
		regExp=new RegExp("dialog|Dialog");
		if(regExp.test(className)){
			popupType="dialog";
		}
		
		//frameWindow
		if(popupType=="frame"){
			regExp=new RegExp("frame");
			if(regExp.test(className)){
				size="";
			}
			regExp=new RegExp("largeFrame");
			if(regExp.test(className)){
				size="large";
			}
			regExp=new RegExp("smallFrame");
			if(regExp.test(className)){
				size="small";
			}
			regExp=new RegExp("fullScreenFrame");
			if(regExp.test(className)){
				size="fullScreen";
			}
			
			regExp=new RegExp("freeFrame");
			if(regExp.test(className)){
				size="free";
			}
			//if(href!="" && href!="#" && href!="###" && typeof(href)!="undefined" && href!=null){
				//console.log(href);
				//var frameWindow=top.htmlTurbo.openFrameWindow(href,title,size);
				//top.htmlTurbo.setFocusFrameWindow(frameWindow)
				console.log(target);
				console.log(context);
				var frameWindow=context.htmlTurbo.openFrameWindow(href,title,size);
				context.htmlTurbo.setFocusFrameWindow(frameWindow)
				return false;
			//}
		}
		
		//dialog
		if(popupType=="dialog"){
			regExp=new RegExp("dialog");
			if(regExp.test(className)){
				size="";
			}
			regExp=new RegExp("largeDialog");
			if(regExp.test(className)){
				size="large";
			}
			regExp=new RegExp("smallDialog");
			if(regExp.test(className)){
				size="small";
			}
			regExp=new RegExp("fullDialog");
			if(regExp.test(className)){
				size="fullScreen";
			}
			
			regExp=new RegExp("freeDialog");
			if(regExp.test(className)){
				size="free";
			}
			if(href!="" && href!="#" && typeof(href)!="undefined" && href!=null){
				//top.htmlTurbo.openDialog(href);
				htmlTurbo.openDialog(href);
				return false;
			}
		}
		
		return true;
	}
	HTMLTurbo.control.A=A;